﻿using Sc.Domain;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sc.Persistence
{
    public class UserDAO
    {
        /// <summary>
        /// 用户登录时更新用户手机唯一标识
        /// </summary>
        /// <param name="token">手机唯一标识</param>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        public int UpdateToken(string token,int userId)
        {
            string sql = "UPDATE Users SET Token=@Token WHERE Id=@UserId";
            SqlParameter[] param = new SqlParameter[]{
                new SqlParameter("@Token",SqlDbType.NVarChar),
                new SqlParameter("@UserId",SqlDbType.Int)
            };
            param[0].Value = token;
            param[1].Value = userId;
            return DbHelperSQL.ExecuteSql(sql, param);
        }
    }
}
